<template>
  <div class="year-container">
    <div class="title">
      <p>年度游客量对比</p>
      <img src="../../images/dataScreen-title.png" alt="" />
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<script setup lang="ts">
  import { onMounted, ref } from 'vue'
  import * as echarts from 'echarts'

  const charts = ref<HTMLDivElement | null>(null)
  onMounted(() => {
    let myCharts = echarts.init(charts.value)
    myCharts.setOption({
      title: {
        text: '散点图',
        left: '40%',
        textStyle: {
          color: '#fff',
        },
      },
      xAxis: {
        type: 'category',
        // show: false
        axisLine: {
          lineStyle: {
            color: '#fff',
          },
        },
      },
      yAxis: {
        show: false,
      },
      series: [
        {
          type: 'scatter',
          data: [33, 23, 23, 54, 564, 12, 34, 112, 323, 43, 235],
          symbol: 'pie',
          label: {
            show: true,
            position: 'top',
            color: '#fff',
          },
        },
      ],
      grid: {
        left: 20,
        right: 20,
        top: 40,
        bottom: 20,
      },
    })
  })
</script>

<style lang="scss" scoped>
  .year-container {
    width: 100%;
    height: 100%;
    background: url(../../images/dataScreen-main-cb.png) no-repeat;
    background-size: 100% 100%;
    margin-top: 20px;
    .title {
      // margin-left: -5px;
      p {
        color: #fff;
        font-size: 20px;
      }
    }

    .charts {
      height: calc(100% - 30px);
    }
  }
</style>
